/**
 * @ClassName CODRemovalRateController
 * @Description TODO
 * @Author 沉默小吴
 * @Date 2024/12/24 15:13
 */
package com.tledu.operate.count.controller;

import com.tledu.operate.count.entity.CODRemovalRate;
import com.tledu.operate.count.entity.vo.CODRemovalRateJSON;
import com.tledu.operate.count.service.ICODRemovalRateService;
import com.tledu.operate.count.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin(origins = "http://localhost")
public class CODRemovalRateController {
    @Autowired
    private ICODRemovalRateService codRemovalRateServiceImpl;

    @GetMapping("/api/datas")
    public Map<String, Object> getCODRemovalRates(
            @RequestParam String startDate,
            @RequestParam String endDate,
            @RequestParam String departmentId) {
        System.out.println(startDate+" "+endDate+" "+departmentId);
        return codRemovalRateServiceImpl.getCODRemovalRates(DateUtils.initializeDateTimes(startDate, endDate)[0], DateUtils.initializeDateTimes(startDate, endDate)[1], departmentId);
    }
}